//
//  Path.h
//  SSE
//
//  Created by Matt Roman on 10/29/07.
//  Copyright 2007 __MyCompanyName__. All rights reserved.
//

#import <Cocoa/Cocoa.h>
#import "Point3.h"
#import "Cspace.h"
#import "node.h"
#import "Rover.h"
#import "Bud.h"

#ifndef MFUNS_H
#define MFUNS_H
#include "Mfuns.h"
#endif

#define ROVERCSPACE		0.002	// the distance drive points are calculated away from CSpace
#define MAXLINKS	1000

@interface Path : NSObject {
	BOOL				driveComplete;	//flag indicating that a fully driven path is complete
	BOOL				incompletePath;	// flag indicating whether or no the path is good
	BOOL				draw;		// path drawing flag NO when it is not drawn YES when it is drawn
	float				pathStep;	// distance the rover travels between sensor updates
	NSColor				*Pcolor;	// holds the color of the path
	float				senseRadius;	// the sensor radius around the robot in meters for path creation
	Rover				*robot;
	Point3f				*roboPosition;	// current position of the robot
	float				*roboAlpha;		// current alpha of the robot
	double				shortDist;		// shortest distance to the goal so far
	double				pathEff;		// shortest path efficiency based on path start point
	int					roboTurn;		// number of times the rover changed direction
	double				tempDist;
	int					pathBreadthPerPass;	// the number of vertices to look at during recursion
	float				pathAngleLimit;	// the angular limit for path calculation
	node				*Start;			// starting point node
	node				*waypoint;		// intermediate waypoint
	node				*End;			// goal point node
	int					onObstacle;		// the obstacle number the rover is driving around
	NSMutableArray		*CspaceArray;	// array of Cspace objects
	NSMutableArray		*obstacles;		// array of Cspace objects in range of robot
	NSMutableArray		*Lines;			// array of Point3 objects
	NSMutableArray		*ShortestPath;	// array of node objects
	NSMutableArray		*DrivenPath;	// array of Point3 objects
	NSMutableArray		*NodeList;		// array of Mutable Arrays containing nodes
}
// init a path object with start and end points, set the sensor radius and get the list of obstacles
- (id) initPathWithRover:(Rover *)robo Sense:(float)sense Color:(NSColor *)color;
// sets the color of the shortest path
- (void) setPcolor:(NSColor *)color;
// returns the color of the shortest path
- (NSColor *) Pcolor;
// get the list of obstacles
- (void) setSharedCspaceArray:(NSMutableArray *)array;
// draws the pathways if x is YES and the shortest path if y is YES
- (void) DrawPathways:(BOOL)x;
- (BOOL) DrivePath;
- (float) pathDistance;
- (double) pathEfficiency;
- (float) senseRadius;
- (void) setSenseRadius:(float)sr;
- (int) roboTurn;
- (NSNumber *) pathDisplay;
- (void) setPathDisplay:(NSNumber *)flag;
- (void) setPathBreadthPerPass:(int)x;
- (void) setAngularLimit:(float)a;
- (void) setPathStep:(float)step;
- (bool) incompletePath;
- (void) dealloc;
- (void) testObj:(int)num;
@end
